﻿using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;

namespace BUS
{
    public class tbMaSoSPBUS
    {
        public static void Insert_MaSoSP(tbMaSoSP masosp)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Insert(masosp);
        }
        public static void Update_MaSoSP(tbMaSoSP masosp)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Update(masosp);
        }
        public static void Delete_MaSoSP(int Id)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Delete(Id);
        }
        public static tbMaSoSP.tbMaSoSPCollection Get(string Where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {

            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            return (masospDAL.Get(Where, pageindex, pagesize, orderby, orderdirection, out total));
        }
        public static tbMaSoSP.tbMaSoSPCollection GetAll()
        {
            int total = 0;
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            return masospDAL.Get("Where 1=1", 0, 0, tbMaSoSP.tbMaSoSPColumns.IDMSSP.ToString(), "ASC", out total);
        }
        public static tbMaSoSP GetByID(int iD)
        {
            int total = 0;
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            tbMaSoSP.tbMaSoSPCollection masospcollection = masospDAL.Get("where " + tbMaSoSP.tbMaSoSPColumns.IDMSSP.ToString() + "=" + iD.ToString(), 0, 0, tbMaSoSP.tbMaSoSPColumns.IDMSSP.ToString(), "ASC", out total);
            if (masospcollection.Count > 0)
                return masospcollection[0];
            return null;
        }

    } 
}
